package com.deli.entity;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Auther: xudeli
 * @Date: 2018/8/26/026 39
 * @Description: testapplicationconfig
 * 通过configurationProperties告诉springboot加载配置信息 prefix 是以什么什么开头的
 * 通过Component将这个组件加载到容器中才能使这个配置信息生效
 */

@Component
@ConfigurationProperties(prefix = "person")
@Validated
@PropertySource(value = {"classpath:person.properties"})
public class Person {

    private String name;

    private int age;

    private Date date;

    private Map<String,Object> maps;

    private List<String> lists;

    private Zoo zoo;

    @Email
    private String email;

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", date=" + date +
                ", maps=" + maps +
                ", lists=" + lists +
                ", zoo=" + zoo +
                ", email='" + email + '\'' +
                '}';
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Map<String, Object> getMaps() {
        return maps;
    }

    public void setMaps(Map<String, Object> maps) {
        this.maps = maps;
    }

    public List<String> getLists() {
        return lists;
    }

    public void setLists(List<String> lists) {
        this.lists = lists;
    }

    public Zoo getZoo() {
        return zoo;
    }

    public void setZoo(Zoo zoo) {
        this.zoo = zoo;
    }

}

